package com.zx.cloud.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.zx.cloud.ApiVersion;
import com.zx.cloud.common.filter.CurrentUserId;
import com.zx.cloud.controller.client.ClientInfoClient;
import com.zx.cloud.domain.ClientBankCard;
import com.zx.cloud.domain.ClientContact;
import com.zx.cloud.domain.ClientInfo;
import com.zx.cloud.domain.Proposal;
import com.zx.cloud.model.response.ObjectDataResponse;
import com.zx.cloud.util.Page;

import io.swagger.annotations.ApiOperation;

/**
 * @Description:
 *
 * @author       Yan Weiwei
 * @Create Time: 2017年11月14日上午11:05:28
 */
@RestController
@RequestMapping(value = ApiVersion.API_V1_PREFIX+"/clientInfo", produces = {MediaType.APPLICATION_JSON_UTF8_VALUE}, consumes = {MediaType.APPLICATION_JSON_UTF8_VALUE})
public class ClientInfoController {

	@Autowired
	private ClientInfoClient clientInfoClient;
	
	@ApiOperation(value = "修改会员详细信息" , notes = "修改会员详细信息")
	@RequestMapping(value = "/updateClientInfo", method = RequestMethod.POST)
	@ResponseBody
	public ObjectDataResponse<Integer> updateClientInfo(@CurrentUserId Long userId,@RequestBody  ClientInfo clientInfo){
		ObjectDataResponse<Integer> data = clientInfoClient.updateClientInfo(clientInfo);
		return data;
	}
	
	@ApiOperation(value = "获取会员详细信息（包括认证、银行卡）" , notes = "获取会员详细信息（包括认证、银行卡）")
	@RequestMapping(value = "/getClientInfo", method = RequestMethod.POST)
	@ResponseBody
	public ObjectDataResponse<ClientInfo> getClientInfo(@CurrentUserId Long userId){
		ObjectDataResponse<ClientInfo> datas = clientInfoClient.getClientInfo();
		return datas;
	}
	
	@ApiOperation(value = "绑卡认证—保存银行卡信息" , notes = "绑卡认证—保存银行卡信息")
	@RequestMapping(value = "/handleClientBankCard", method = RequestMethod.POST)
	@ResponseBody
	public ObjectDataResponse<Integer> handleClientBankCard(@CurrentUserId Long userId, @RequestBody ClientBankCard clientBankCard){
		
		ObjectDataResponse<Integer> success = clientInfoClient.handleClientBankCard(clientBankCard);
		
		return success;
	}
	
	@ApiOperation(value = "查询意见反馈信息Api" , notes = "查询意见反馈信息")
	@RequestMapping(value = "queryProposalApi", method = RequestMethod.POST)
	@ResponseBody
	public ObjectDataResponse<Page<Proposal>> queryProposalApi(@RequestBody Proposal proposal){
		return  clientInfoClient.queryProposalApi(proposal);
		 
	}
	
	@ApiOperation(value = "添加意见反馈信息Api" , notes = "添加意见反馈信息")
	@RequestMapping(value = "addProposalApi", method = RequestMethod.POST)
	@ResponseBody
	public ObjectDataResponse<Integer> addProposalApi(@RequestBody Proposal proposal){
		return  clientInfoClient.addProposalApi(proposal);
		 
	}
	
	@ApiOperation(value = "获取会员联系人信息列表" , notes = "获取会员联系人信息列表")
	@RequestMapping(value = "getClientContactMsg", method = RequestMethod.POST)
	@ResponseBody
	public ObjectDataResponse<Integer> getClientContactMsg(@CurrentUserId Long userId, @RequestBody ClientContact clientContact){
		ObjectDataResponse<Integer> success = clientInfoClient.getClientContactMsg(clientContact);
		return  success;
		 
	}
}
